<template>
	<div class="container">
		<div class="img" :style="`height:${height}px;background-image: url(${info.imgUrl});`" @click="imgClick()">
		</div>
		<div class="title">{{ info.title }}</div>
		<el-dialog :visible.sync="dialogVisible" top="20vh" width="80%" :center="true" :append-to-body="true"
			class="iframe-dialog">
			<template slot="title">
				<div class="iframe-title">{{ info.title }}</div>
			</template>
			<div class="main">
				<img class="left" :src="info.imgUrl" />
				<div class="right">
					<div class="text">{{ info.content }}</div>
				</div>
			</div>
		</el-dialog>
	</div>
</template>

<script>
	export default {
		name: 'infoCard',
		data() {
			return {
				dialogVisible: false,
			}
		},
		props: {
			info: {
				type: Object,
				default () {
					return {};
				},
			},
			height: {
				type: Number,
				default: 190
			}
		},
		mounted() {},
		methods: {
			imgClick() {
				this.dialogVisible = true;
			},
		}
	}
</script>

<style scoped lang="scss">
	.container ::v-deep {
		>.img {
			width: 90%;
			padding: 5%;
			margin-top: 10px;
			background-size: 100% 100%;
			font-size: 10px;
			line-height: 27px;
			cursor: pointer;
			overflow-y: auto;
		}

		>.title {
			text-align: center;
			width: 100%;
			height: 30px;
			line-height: 30px;
			position: absolute;
			top: -30px;
			left: 0;
			bottom: 0;
			background-color: rgba(0, 0, 0, .5);
			color: #fff !important;
		}
	}

	.iframe-dialog ::v-deep {
		
		.iframe-title{
			text-indent: 2em;
			font-size: 20px;
			color: #fff;
			line-height: 20px;
		}
		
		.el-dialog {
			border: 3px solid transparent;
			-webkit-border-image: url('../../assets/img/dialogBg.png') 3 stretch;
			background-image: url('../../assets/img/pageBg.png');
			background-size: 100% 100%;

			.el-dialog__header {
				margin-top: 0px;

				>.el-dialog__title {
					color: #fff;
					font-size: 25px;
					font-weight: bold;
				}

				i {
					width: 20px;
					height: 20px;
					background-image: url('../../assets/img/gban.png');
					background-size: 100% 100%;
				}

				.el-icon-close:before {
					content: '';
				}
			}

			.main {
				margin-top: 20px;
				display: flex;
				justify-content: space-between;
				padding-left: 20px;
				padding-right: 20px;

				>.left {
					width: 25%;
					align-self: flex-start;
					border: 3px solid transparent;
					-webkit-border-image: url('../../assets/img/img-border.png') 3 stretch;
				}

				>.right {
					width: 75%;
					padding-left: 20px;

					>.text {
						text-indent: 2em;
						font-size: 14px;
						color: #fff;
						line-height: 30px;
					}
				}
			}
		}
	}
</style>